<template>
  <div class="chat-view-2">
    <div class="mainContainer">
      <ToolBar />
      <SideBar />
      <ChatBox v-show="sessionIdSelected" />
    </div>
    <!--    <footer class="footer">-->
    <!--      <a target="_blank" rel="noopener">6666666666666666</a>-->
    <!--    </footer>-->
  </div>

</template>

<script setup lang="ts">
import type { Ref } from "vue";
import ToolBar from "@/components/ToolBar/index";
import SideBar from "@/components/SideBar/index";
import ChatBox from "@/components/ChatBox/index";
import { socketLogin } from "@/websocket/socket-io";
import { sessionIdSelectedFunc } from "@/views/ChatView/Hooks";
import { newMessageLengthFunc } from "@/components/ChatBox/Hooks";

//socket.io 连接
socketLogin();

// 获取选中的对话
const [getSessionIdSelected, setSessionIdSelected] = sessionIdSelectedFunc();
const sessionIdSelected: Ref<string> = getSessionIdSelected();

// 初始化未读数据
const [getNewMessageLengthObj, setNewMessageLength, initNewMessageLength] = newMessageLengthFunc();
initNewMessageLength();

</script>

<style scoped lang="less">
.chat-view-2 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-image: url('@/assets/img/login_bg.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;

  .mainContainer {
    display: flex;
    flex-direction: row;
    background: var(--color-bg-dark);
    width: 80vw;
    height: 80vh;
    border-radius: 16px;
  }

  .footer {
    margin-top: 4vh;
    font-size: 12px;
    color: #fff;
    text-align: center;
  }
}

</style>
